import { Button } from 'antd';
import styles from './style.less'

const TextButton = (props) => {

    const {
        type = "link",
        onClick,
        children,
        style = {},
    } = props


    if (type === "link") {
        return <Button
            type="link"
            size="small"
            style={style}
            onClick={onClick}>{children}</Button>
    }

    if (type === "primary") {
        return <Button
            className={styles.primaryText}
            type="link"
            size="small"
            shape="round"
            style={style}
            onClick={onClick}>{children}</Button>
    }

    if (type === "danger") {
        return <Button
            type="text"
            danger
            size="small"
            style={style}
            onClick={onClick}>{children}</Button>
    }

    if (type === "warning") {
        return <Button
            type="text"
            size="small"
            style={{
                ...style,
                color:"#faad14"
            }}
            onClick={onClick}>{children}</Button>
    }

    if (type === "plain") {
        return <Button
            type="text"
            size="small"
            style={style}
            onClick={onClick}>{children}</Button>
    }

    if (type === "text") {
        return <a
            type="text"
            style={{
                height:"20px",
                ...style
            }}
            onClick={onClick}>{children}</a>
    }
}

export default TextButton